package io.char_stream;

import java.io.*;

public class Demo05_Buffered {
    /*
    带缓冲区的流中的特殊方法：
    BufferReader中的特有方法
    readLine():
    newLine()：换行的作用，底层是System.lineSeparator()也就是:\r\n

    newLine() 和 \r\n 的区别：
    newLine()是跨平台的而\r\n 只支持windows系统

     */
    public static void main(String[] args) throws IOException {
        //extracted();

        BufferedReader br = new BufferedReader(new FileReader("D:\\wangdao_study\\studyHard\\添狗.txt"));
        BufferedWriter bw = new BufferedWriter(new FileWriter("999.txt"));

        String line;

        while((line = br.readLine()) != null) {
            bw.write(line);
            bw.newLine();//底层是System.lineSeparator()也就是:\r\n
        }

        br.close();
        bw.close();


    }

    private static void extracted() throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("D:\\wangdao_study\\studyHard\\添狗.txt"));
        String line;

        while((line = br.readLine()) != null) {
            System.out.println(line);
        }
    }
}
